package com.dcw.lixb.designmode.singleinstance;

/**
 * @author lixiaobin
 * @date 2020-07-16 17:25:21
 * @desc 懒汉式，线程安全
 *是否 Lazy 初始化：是
 *
 * 是否多线程安全：是
 *
 * 实现难度：易
 */
public class SingleC {
    private static SingleC sInstance;

    private SingleC() {
        try {
            Thread.sleep(200L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public  static synchronized SingleC getInstance() {
        if (null == sInstance) {
            sInstance = new SingleC();
        }
        return sInstance;
    }
}
